package com.xingyue.loginqueryarticle.filers;
/*
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**给所有请求响应设置编码
 * Created by hdwx on 2016/11/18.
 */
 //编码过滤器类*/
/*
@WebFilter(urlPatterns = "/*")
public class EncodingFilters implements Filter {
//web 容器启动加载项目时方法执行
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
System.out.print("编码filter init");
    }
//做过滤的动作
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
   servletRequest.setCharacterEncoding("utf-8");
    servletResponse.setCharacterEncoding("utf-8");
    System.out.print(".............ebcoding filter执行了");
//继续交给下一个过滤器执行,若没有下一个过滤器直接到达请求地址(servlet)
    filterChain.doFilter(servletRequest,servletResponse);
    }
@Override
   public void destroy(){
System.out.print("编码filter destroy");
   }
}
*/